import config from '@/config';
import RequestBase from '@/utils/request.js';

const request = new RequestBase(config.specialWorkUrl);

/**
 * @description 执行作业票
 */
export function performTicket(taskId, data) {
  return request.post(`/spw/ticket-exec/exec/${taskId}`, data);
}

/**
 * @description 获取待执行作业票列表
 */
export function getPendingPerformTicketList(data) {
  return request.get(`/spw/ticket-exec/exec-list`, data);
}

/**
 * @description 获取执行中作业票列表
 */
export function getPerformingTicketList(data) {
  return request.get(`/spw/ticket-exec/to-check-list`, data);
}

/**
 * @description 获取待验收作业票列表
 */
export function getAcceptTicketList(data) {
  return request.get(`/spw/ticket-exec/accept-list`, data);
}

/**
 * @description 提验作业票
 */
export function submitCheckTicket(taskId, data) {
  return request.post(`/spw/ticket-exec/submit-check/${taskId}`, data);
}

/**
 * @description 分析作业票
 */
export function submitAnalyseTicket(data) {
  return request.post(`/spw/ticket-review/analyse`, data);
}

/**
 * @description 获取作业票执行记录列表
 */
export function getPerformTicketLogList(ticketId) {
  return request.get(`/spw/ticket-exec/exec-list/${ticketId}`);
}

/**
 * 获取作业票提验信息
 */
export function getCheckTicketInfo(ticketId) {
  return request.get(`/spw/ticket-exec/to-check-info/${ticketId}`);
}

/**
 * 启停作业票
 */
export function updateTicketPauseStatus(data) {
  return request.post('/spw/ticket-review/pause/', data);
}

/**
 * 获取执行票记录列表
 */
export function getPerformTicketHistory(data) {
  return request.get('/spw/ticket-exec/his-list', data);
}

/**
 * 添加作业人员
 */
export function addWorkPersonal(data) {
  return request.post('/spw/ticket-exec/add-personal', data);
}

/**
 * 更换监护人
 */
export function updateGuardian(data) {
  return request.post('/spw/ticket-review/change-guardian', data);
}
